package com.ccp.dev.qbdms.controller.view;

import com.alibaba.fastjson.JSONObject;
import com.ccp.dev.core.basic.annotion.Action;
import com.ccp.dev.core.basic.consts.UrlConstants;
import com.ccp.dev.core.basic.internationalization.SysBaseController;
import com.ccp.dev.core.basic.model.SysAuditModelType;
import com.ccp.dev.qbdms.model.Demo;
import com.ccp.dev.qbdms.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
@Action(ownermodel = SysAuditModelType.NULL)
//格式：项目名/模块名
@RequestMapping("/qbdms/qbdms")
public class ViewDemoController  extends SysBaseController {

    @Autowired
    private DemoService demoService;
    /**
     * 跳转XX页面
     * @return
     */
    @Action(description="XX页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/qbdmsAdd")
    public String viewDemoAdd(){
        return "demo/qbdmsAdd";
    }

    /**
     * 跳转XX页面
     * @return
     */
    @Action(description="XX页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/qbdmsEdit")
    public String viewDemoEdit(String demoId, Model model){
        Demo demo = demoService.getDemo(demoId);
        model.addAttribute("demoId",demoId);
        return "demo/qbdmsEdit";
    }

    /**
     * 跳转XX页面
     * @return
     */
    @Action(description="XX页面跳转",exectype = "页面跳转日志")
    @RequestMapping(UrlConstants.VIEW_DISPATCH_PREFIX+"/qbdmsList")
    public String viewDemoList(){
        return "demo/qbdmsList";
    }
}
